﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LINQUnionTest
{
    class foo
    {
        private string Hello = "Hello";
        private string World = "World";

        public string HelloWorld
        {
            get { return Hello + " " + World; }
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            var list1 = new List<int> { 0, 1, 2, 3 };
            var list2 = new List<int> { 0, 1, };

            //Test 1: list3
            var list3 = list1.Union(list2);

            //Test 2: list4
            //Empty collection
            var list4 = list1.Where(li => li < 0);
            foreach (int i in list2)
            {
                list4 = list4.Union(list1.Where(li => li == i)).ToList();
            }

            //Test 3: list5
            var list5 = list1.Where(li => li < 0);
            foreach (int i in list2)
            {
                int j = i;
                list5 = list5.Union(list1.Where(li => li == j)).ToList();
            }

            Console.ReadKey();
        }
    }
}
